package com.eazy.lkv2.core.util;


import net.glxn.qrgen.core.image.ImageType;
import net.glxn.qrgen.javase.QRCode;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * Created by hpb on 2018/5/11.
 */
public class QrUtil {
    public static void genFile(String url,String path){
        FileOutputStream fileOutputStream=null;
        try {
             fileOutputStream=new FileOutputStream(path);
            QRCode.from(url).to(ImageType.JPG).withSize(300, 300).writeTo(fileOutputStream);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }finally {
            try {
                fileOutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
